<!--
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<table id="jobSettingTable" class="table table-bordered">
    <tr class="row">
        <th colspan="2">Task Settings</th>
    </tr>
    <tr class="row">
        <td width="30%">Maximum Run Time</td>
        <td width="70%">
            <input name="maxRunTime" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.maxRunTime%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Run Interval</td>
        <td width="70%">
            <input name="rekickTimeout" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.rekickTimeout%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Job Priority</td>
        <td width="70%">
            <input name="priority" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.priority%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Minion Type</td>
        <td width="70%">
            <input name="minionType" type='text' class="form-control trackable" style="margin:0px;" type="text" value="<%-job.minionType%>" <%-(_.isUndefined(job.id)? '' : 'disabled')%> ></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Max Simultaneous Running Tasks</td>
        <td width="70%">
            <input name="maxSimulRunning" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.maxSimulRunning%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Enable Automatic Retries</td>
        <td width="70%">
            <input name="autoRetry" type="checkbox" class="trackable" <%-(job.autoRetry?"checked='true'":"")%>>
            &nbsp;&nbsp;Retries tasks if jvm crashes (exit status = 128 + 6 (SIGABRT))
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Basic Hydra Alerts</td>
        <td width="70%">
            <input name="basicAlerts" type="checkbox" class="trackable" <%-(job.basicAlerts?"checked='true'":"")%>>
            &nbsp;&nbsp;Creates 3 email/webhook alerts (error, rekick, runtime) that go to the team who owns the job.
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Basic Hydra Pagerduty</td>
        <td width="70%">
            <input name="basicPages" type="checkbox" class="trackable" <%-(job.basicPages?"checked='true'":"")%>>
            &nbsp;&nbsp;Creates 3 pagerduty alerts (error, rekick, runtime) that go to the team who owns the job.
        </td>
    </tr>
    <tr class="row">
        <th colspan="2">Backup Settings</th>
    </tr>
    <tr class="row">
        <td width="30%">Hourly Backups</td>
        <td width="70%">
            <input name="hourlyBackups" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.hourlyBackups%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Daily Backups</td>
        <td width="70%">
            <input name="dailyBackups" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.dailyBackups%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Weekly Backups</td>
        <td width="70%">
            <input name="weeklyBackups" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.weeklyBackups%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Monthly Backups</td>
        <td width="70%">
            <input name="monthlyBackups" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.monthlyBackups%>"></input>
        </td>
    </tr>
    <tr class="row">
        <th colspan="2">Replica Settings</th>
    </tr>
    <tr class="row">
        <td width="30%">Number of Replicas</td>
        <td width="70%">
            <input name="replicas" class="form-control trackable" style="margin:0px;" type="number" value="<%-job.replicas%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Do not delete</td>
        <td width="70%"><input name="dontDeleteMe" class="trackable" type="checkbox" <%-(job.dontDeleteMe?"checked='true'":"")%>></td>
    </tr>
    <tr class="row">
        <td width="30%">Do not clone</td>
        <td width="70%"><input name="dontCloneMe" class="trackable" type="checkbox" <%-(job.dontCloneMe?"checked='true'":"")%>></td>
    </tr>
    <tr class="row">
        <td width="30%">Do not automatically balance data</td>
        <td width="70%"><input name="dontAutoBalanceMe" class="trackable" type="checkbox" <%-(job.dontAutoBalanceMe?"checked='true'":"")%>></td>
    </tr>
    <tr class="row">
        <th colspan="2">Permissions Settings</th>
    </tr>
    <tr class="row">
        <td width="30%">Creator</td>
        <td width="70%">
            <input name="creator" class="form-control trackable" readonly style="margin:0px;" type="text" value="<%-job.creator%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Owner</td>
        <td width="70%">
            <input id="jobOwner" name="owner" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.owner%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Group</td>
        <td width="70%">
            <input id="jobGroup" name="group" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.group%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Writable</td>
        <td>
            <input id="ownerWritable" name="ownerWritable" class="trackable" style="margin:0px;" type="checkbox" <%-(job.ownerWritable?"checked='true'":"")%>></input>
            <label for="ownerWritable">owner</label>
            <input id="groupWritable" name="groupWritable" class="trackable" style="margin-left:10px;" type="checkbox" <%-(job.groupWritable?"checked='true'":"")%>></input>
            <label for="groupWritable">group</label>
            <input id="worldWritable" name="worldWritable" class="trackable" style="margin-left:10px;" type="checkbox" <%-(job.worldWritable?"checked='true'":"")%>></input>
            <label for="worldWritable">world</label>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Executable</td>
        <td>
            <input id="ownerExecutable" name="ownerExecutable" class="trackable" style="margin:0px;" type="checkbox" <%-(job.ownerExecutable?"checked='true'":"")%>></input>
            <label for="ownerExecutable">owner</label>
            <input id="groupExecutable" name="groupExecutable" class="trackable" style="margin-left:10px;" type="checkbox" <%-(job.groupExecutable?"checked='true'":"")%>></input>
            <label for="groupExecutable">group</label>
            <input id="worldExecutable" name="worldExecutable" class="trackable" style="margin-left:10px;" type="checkbox" <%-(job.worldExecutable?"checked='true'":"")%>></input>
            <label for="worldExecutable">world</label>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Last Modified By</td>
        <td width="70%">
            <input name="lastModifiedBy" class="form-control trackable" readonly style="margin:0px;" type="text" value="<%-job.lastModifiedBy%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">Last Modified At</td>
        <td width="70%">
            <input name="lastModifiedAt" class="form-control trackable" readonly style="margin:0px;" type="text" value="<%-new Date(job.lastModifiedAt).toString('MM/dd/yy HH:mm')%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">&nbsp;</td>
        <td wdith="70%"><button type="button" id="settingsChangePermission" class="btn btn-default" >Change Permissions</button>
            <span style="vertical-align:middle" >Owner and group can change permissions when writable status is disabled.</span></td>
    </tr>
    <tr class="row">
        <th colspan="2">Query Settings</th>
    </tr>
    <tr class="row">
        <td width="30%">Enable querying on this job</td>
        <td width="70%">
            <input name="qc_canQuery" type="checkbox" class="trackable" <%-(job.qc_canQuery?"checked='true'":"")%>>
        </td>
    </tr>
    <tr class="row">
        <th colspan="2">Post Hooks</th>
    </tr>
    <tr class="row">
        <td width="30%">On Success..</td>
        <td width="70%">
            <input name="onComplete" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.onComplete%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">On Success Timeout (seconds)</td>
        <td width="70%">
            <input name="onCompleteTimeout" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.onCompleteTimeout%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">On Error..</td>
        <td width="70%">
            <input name="onError" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.onError%>"></input>
        </td>
    </tr>
    <tr class="row">
        <td width="30%">On Error Timeout (seconds)</td>
        <td width="70%">
            <input name="onErrorTimeout" class="form-control trackable" style="margin:0px;" type="text" value="<%-job.onErrorTimeout%>"></input>
        </td>
    </tr>
</table>
